﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gsn.Credentials.Engine.Properties;

using Gsn.Base;

namespace Gsn.Credentials.Engine
{
    public class CredentialsEngine : ICredentialsEngine
    {
        #region ICredentialsEngine Members

        public string UserName
        {
            get
            {
                return Settings.Default.userName;
            }
            set
            {
                Settings.Default.userName = value;
                Settings.Default.Save();
            }
        }

        public string Password
        {
            get
            {
                return Settings.Default.password;
            }
            set
            {
                Settings.Default.password = value;
                Settings.Default.Save();
            }
        }

        #endregion

        #region IEngine Members

        public bool Running
        {
            get { return true; }
        }

        public void StartEngine(string userName, string password)
        {
            if(userName != null && password != null)
            {
                this.UserName = userName;
                this.Password = password;
            }
        }

        public void StopEngine()
        {
        }

        #endregion
    }
}
